<h4 class="h4"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>&nbsp;修改学生信息</h4>
<form class="form-horizontal" action="comm/studentedit.php" method="post" id="tj">
    
    <div class="form-group">
        <label for="username" class="col-sm-2 control-label">姓名</label>
        <div class="col-sm-3">
            <input type="text" class="form-control" id="username" placeholder="姓名" name="name"
                value="<?=$row['name']?>">
        </div>
    </div>
    <div class="form-group">
        <label for="password" class="col-sm-2 control-label">学号</label>
        <div class="col-sm-3">
            <input type="text" class="form-control" id="sid" placeholder="学号" name="sid" value="<?=$row['sid']?>">
        </div>
    </div>
    <div class="form-group">
        <label for="password" class="col-sm-2 control-label">性别</label>
        <div style="margin-top: 3px;">
            <input type="radio" id="customRadioInline1" name="sex" class="custom-control-input"
                style="margin-left: 20px;" checked="checked" value="男">
            <label class="custom-control-label" for="customRadioInline1">男</label>
            <input type="radio" id="customRadioInline2" name="sex" class="custom-control-input"
                style="margin-left: 40px;" value="女">
            <label class="custom-control-label" for="customRadioInline2">女</label>
        </div>
    </div>
    <input type="hidden" name="id" value="<?=$row['id']?>">
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-ok"
                    aria-hidden="true"></span>&nbsp;更新
            </button>
        </div>
    </div>
</form>
<script>
    $('#tj').on('submit', function () {
        console.log($(this).serializeArray())
        if (!$(this).serializeArray()[0].value) {
            layer.msg('姓名不能为空!', { icon: 5, time: 1000, offset: '550px', anim: 6 });
            return false;
        }
        if (!$(this).serializeArray()[1].value) {
            layer.msg('学号不能为空!', { icon: 5, time: 1000, offset: '550px', anim: 6 });
            return false;
        }
        if (!$(this).serializeArray()[2].value) {
            layer.msg('性别不能为空!', { icon: 5, time: 1000, offset: '550px', anim: 6 });
            return false;
        }
        return true;
    })
</script>